<template>
  <div>
    <div class="wrapper">
    <div class="container container-login">
        <div class="signup-forms flip">
            <div class="login-box" id="_j_login_box">
                <div class="inner inner_v2 clearfix">
                    <div class="inner_v2_left">
                        <form id="_j_login_form" method="post" >
                            <div class="form-field">
                                <input name="username" type="text" placeholder="您的手机号" autocomplete="off"
                                       data-verification-name="帐号"  v-model="userVal">
                                <div class="err-tip"></div>
                            </div>
                            <div class="form-field">
                                <input name="password" type="password" placeholder="您的密码" autocomplete="off" data-verification-name="密码"
                                       class="verification[required,minSize[4],maxSize[50]]" v-model="pwdVal">
                                <div class="err-tip"></div>
                            </div>
                            <div class="form-link"><a href="javascript:;">忘记密码</a></div>
                            <div class="submit-btn">
                                <button id="_js_loginBtn" type="button" @click="LoginFn">登 录</button>
                            </div>
                        </form>
                        <div class="connect">
                            <p class="hd">用合作网站账户直接登录</p>
                            <div class="bd">
                                <a href="javascript:;" class="weibo"><i></i>新浪微博</a>
                                <a href="javascript:;" class="qq"><i></i>QQ</a>
                                <a href="javascript:;" class="weixin"><i></i>微信</a>
                                <div class="clear"></div>
                            </div>
                        </div>                        </div>
                </div>
                <div class="bottom-link">
                    还没有帐号?<a href="/regist.html">马上注册</a>
                </div>
            </div>
        </div>

    </div>
</div>
<div class="fullscreen-bg"
     style="background-image: url(http://xue.cnkdl.cn:8808/images/34.jpg);">
    <img src="http://xue.cnkdl.cn:8808/images/34.jpg" style="width: auto; height: 657px; margin-top: -213px;">
</div>
  </div>
</template>

<script>
import { UserLoginApi } from '@/utils/api'
import { mapMutations, } from 'vuex'
import qs from "qs";
export default {
  data () {
    return {
      userVal:'18924965973',
      pwdVal:'123456'
 
    }
  },
  methods:{
    ...mapMutations({
      changeIsLogined: "Loginstatus/changeIsLogined",
    }),
    async LoginFn(){
      console.log(this.userVal);
      console.log(this.pwdVal);
      let res = await UserLoginApi({
        // data:{
        //   username:this.userVal,
        //   password:this.pwdVal
        // },
        data: qs.stringify({
          username:this.userVal,
          password:this.pwdVal
        }),
        method:'POST',
      })
      localStorage.setItem('token',res.data.token)
      // console.log(res.data.token);
     
      localStorage.getItem('token')
      //  console.log(token);
      // console.log(this.isLogined);
      this.changeIsLogined(true);
       this.$router.push('/')
    }
  }
}
</script>
 
<style lang = "less" scoped>
  
</style>